package org.glorylight.hacks.social.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "tag")
public class Tag implements Serializable {

	private static final long serialVersionUID = -8044423005893168449L;

	@Id
	@Column(name = "tag_name", length = 25)
	private String tagName;

	@OneToMany(mappedBy = "tag", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	private List<ScrapBook> pages = new ArrayList<ScrapBook>();
	
	@Column(name = "tag_count", columnDefinition="BIGINT default '0'")
	private Long tagCount;

	public Tag() {
	}

	public Tag(String tagName) {
		this.tagName = tagName;
	}

	public String getTagName() {
		return tagName;
	}

	public void setTagName(String tagName) {
		this.tagName = tagName;
	}

	public List<ScrapBook> getPages() {
		return pages;
	}

	public void setPages(List<ScrapBook> pages) {
		this.pages = pages;
	}

	public Long getTagCount() {
		return tagCount;
	}

	public void setTagCount(Long tagCount) {
		this.tagCount = tagCount;
	}

}
